From cfc6832a6f288703ee94a98923d1c04f880459e1 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Sun, 17 Dec 2017 12:28:18 -0700 Subject: [PATCH] generalize make_windows_release for MinGW or MSVC. (#151) make_windows_release.ps1 now can be used with MinGW or MSVC. It is likely we will have to switch compilers with Qt >= 5.6 because MinGW is not supported with webengine, and Qt >= 5.6 release packages from www.qt.io distributes webengine and not webkit (although some other parties build webkit from source with these versions of Qt). appveyor.yml is modified to run a release on one MinGW case (Qt 5.5, webkit) and one MSVC case (Qt 5.6, webengine, 32 bit). In the case of MSVC the VC redistributible installer is run by setup. Note that inno setup compiler is always run in 32 bit mode, so if you use this with 64 bit executables they will install in the wrong place, i.e. "Program Files (x86)" --- appveyor.yml | 26 ++++++++++++++++++-------- gui/app.pro | 2 ++ gui/setup.iss | 16 ++++++++++++++-- gui/setup.iss.in | 16 ++++++++++++++-- tools/make_windows_release.ps1 | 33 ++++++++++++++++----------------- 5 files changed, 64 insertions(+), 29 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 67c41b736..52f5b3b2e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,11 +12,6 @@ environment: platform: mingw qt: 5.6\mingw49_32 tools: mingw492_32 - # MinGW - # - name: win32 - # platform: mingw - # qt: 5.9\mingw53_32 - # tools: mingw530_32 # MSVC x32 - name: win32 platform: x86 @@ -35,11 +30,26 @@ init: # Flesh out with amd64/msvc cases later. build_script: - ps: | + # be aware that vcvarsall will reset platform amd64 to X64! + echo "platform: $env:platform" + echo "qt: $env:qt" + qmake -query + Get-Location if (($env:platform -eq "mingw") -and ($env:qt -eq "5.5\mingw492_32")) { - Get-Location - qmake -query - & ".\tools\make_windows_release.ps1" + # windeployqt in 5.5.1 suffers from bug + # https://bugreports.qt.io/browser/QTBUG-48946 + # which trashes the translations. Work around + # by using the next version of windeployqt which had this + # bug fixed. + & ".\tools\make_windows_release.ps1" -windeployqt "C:\Qt\5.6\mingw49_32\bin\windeployqt.exe" + $sha=(git rev-parse --short HEAD) + Get-ChildItem .\gui\release\GPSBabel-*-Setup.exe | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Setup.exe" } + Get-ChildItem .\gui\release\GPSBabel-*-Manifest.txt | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Manifest.txt" } + } + elseif (($env:platform -eq "x86") -and ($env:qt -eq "5.6\msvc2015")) + { + & ".\tools\make_windows_release.ps1" -gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_6_MSVC2015_32bit-Release" -gui_build_dir_name "build-app-Desktop_Qt_5_6_MSVC2015_32bit-Release" -mkspec win32-msvc2015 -mkcmd nmake.exe $sha=(git rev-parse --short HEAD) Get-ChildItem .\gui\release\GPSBabel-*-Setup.exe | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Setup.exe" } Get-ChildItem .\gui\release\GPSBabel-*-Manifest.txt | % { Push-AppveyorArtifact $_.FullName -FileName "GPSBabelTest-$($env:APPVEYOR_BUILD_VERSION)-$($sha)-Manifest.txt" } diff --git a/gui/app.pro b/gui/app.pro index 6b57f065b..9c25674d8 100755 --- a/gui/app.pro +++ b/gui/app.pro @@ -46,6 +46,8 @@ RC_FILE = app.rc win32 { TARGET=GPSBabelFE +} +win32-g++ { QMAKE_LFLAGS_RELEASE += -static-libgcc } unix:TARGET=gpsbabelfe-bin diff --git a/gui/setup.iss b/gui/setup.iss index 30dd4bf23..4b8e163f5 100644 --- a/gui/setup.iss +++ b/gui/setup.iss @@ -7,6 +7,12 @@ ; Uses the Inno setup compiler. ; windeployqt should be run to prepare the necessary Qt files before ; running Inno Setup. +#ifndef gui_build_dir_name + #define gui_build_dir_name "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release" +#endif +#ifndef gpsbabel_build_dir_name + #define gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_5_1_MinGW_32bit-Release" +#endif [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -39,8 +45,10 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ Source: gmapbase.html; DestDir: "{app}"; Flags: ignoreversion Source: qt.conf; DestDir: "{app}"; Flags: ignoreversion -Source: ..\build-app-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\*; Excludes: "*.cpp,*.o"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: ..\..\build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\gpsbabel.exe; DestDir: "{app}"; Flags: ignoreversion +Source: "..\{#gui_build_dir_name}\release\*"; Excludes: "app.res,vcredist_*.exe,*.cpp,*.h,*.o,*.obj"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "..\{#gui_build_dir_name}\release\vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall +Source: "..\{#gui_build_dir_name}\release\vcredist_x64.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall +Source: "..\..\{#gpsbabel_build_dir_name}\release\gpsbabel.exe"; DestDir: "{app}"; Flags: ignoreversion ; Source: release\help\*; DestDir: "{app}\help"; Flags: ignoreversion recursesubdirs createallsubdirs ; Translation strings extracted from source code. Include it in the dist @@ -66,6 +74,8 @@ Name: "{group}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe" Name: "{commondesktop}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"; Tasks: desktopicon [Run] +Filename: "{app}\vcredist_x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist +Filename: "{app}\vcredist_x64.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist Filename: "{app}\gpsbabelfe.exe"; Description: "{cm:LaunchProgram,GPSBabelFE}"; Flags: nowait postinstall skipifsilent [Registry] @@ -73,3 +83,5 @@ Root: HKCU; Subkey: "Software\GPSBabel"; Flags: uninsdeletekeyifempty Root: HKCU; Subkey: "Software\GPSBabel\GPSBabel"; Flags: uninsdeletekey Root: HKCU; Subkey: "Software\GPSBabel\GPSBabelFE"; Flags: uninsdeletekey +; ISPP preprocessor output can be useful for debug +#expr SaveToFile("PreprocessedScript.iss") diff --git a/gui/setup.iss.in b/gui/setup.iss.in index 9c9e463db..f884fee29 100755 --- a/gui/setup.iss.in +++ b/gui/setup.iss.in @@ -7,6 +7,12 @@ ; Uses the Inno setup compiler. ; windeployqt should be run to prepare the necessary Qt files before ; running Inno Setup. +#ifndef gui_build_dir_name + #define gui_build_dir_name "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release" +#endif +#ifndef gpsbabel_build_dir_name + #define gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_5_1_MinGW_32bit-Release" +#endif [Setup] ; NOTE: The value of AppId uniquely identifies this application. @@ -39,8 +45,10 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ Source: gmapbase.html; DestDir: "{app}"; Flags: ignoreversion Source: qt.conf; DestDir: "{app}"; Flags: ignoreversion -Source: ..\build-app-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\*; Excludes: "*.cpp,*.o"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: ..\..\build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release\release\gpsbabel.exe; DestDir: "{app}"; Flags: ignoreversion +Source: "..\{#gui_build_dir_name}\release\*"; Excludes: "app.res,vcredist_*.exe,*.cpp,*.h,*.o,*.obj"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "..\{#gui_build_dir_name}\release\vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall +Source: "..\{#gui_build_dir_name}\release\vcredist_x64.exe"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist deleteafterinstall +Source: "..\..\{#gpsbabel_build_dir_name}\release\gpsbabel.exe"; DestDir: "{app}"; Flags: ignoreversion ; Source: release\help\*; DestDir: "{app}\help"; Flags: ignoreversion recursesubdirs createallsubdirs ; Translation strings extracted from source code. Include it in the dist @@ -66,6 +74,8 @@ Name: "{group}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe" Name: "{commondesktop}\GPSBabel"; Filename: "{app}\gpsbabelfe.exe"; Tasks: desktopicon [Run] +Filename: "{app}\vcredist_x86.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist +Filename: "{app}\vcredist_x64.exe"; Parameters: "/quiet"; Flags: skipifdoesntexist Filename: "{app}\gpsbabelfe.exe"; Description: "{cm:LaunchProgram,GPSBabelFE}"; Flags: nowait postinstall skipifsilent [Registry] @@ -73,3 +83,5 @@ Root: HKCU; Subkey: "Software\GPSBabel"; Flags: uninsdeletekeyifempty Root: HKCU; Subkey: "Software\GPSBabel\GPSBabel"; Flags: uninsdeletekey Root: HKCU; Subkey: "Software\GPSBabel\GPSBabelFE"; Flags: uninsdeletekey +; ISPP preprocessor output can be useful for debug +#expr SaveToFile("PreprocessedScript.iss") diff --git a/tools/make_windows_release.ps1 b/tools/make_windows_release.ps1 index 2076bba38..6b18dfbcc 100755 --- a/tools/make_windows_release.ps1 +++ b/tools/make_windows_release.ps1 @@ -3,16 +3,20 @@ # Run this from a Qt Desktop command window that has the Qt and mingw compiler paths set up, # such as the one Qt Creator will put on the start menu. # For example, to run overriding the default locations of windeployqt and ISSC: -# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -windeployqt "C:\Qt\5.5\mingw492_32\bin\windeployqt.exe" -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" +# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -windeployqt "C:\Qt\5.6.3\mingw49_32\bin\windeployqt.exe" -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" +# Or to do a 64 bit MSVC build with a newer Qt: +# powershell.exe -ExecutionPolicy Unrestricted -File tools\make_windows_release.ps1 -iscc "C:\Program Files (x86)\Inno Setup 5\ISCC.exe" -gpsbabel_build_dir_name "build-GPSBabel-Desktop_Qt_5_9_3_MSVC2015_64bit-Release" -gui_build_dir_name "build-app-Desktop_Qt_5_9_3_MSVC2015_64bit-Release" -mkspec win32-msvc -mkcmd nmake.exe # # Be aware this script is used by appveyor.yml # -# The defaults should be set for appveyor builds. +# The defaults should be compatible with appveyor builds. Param( - $windeployqt = "C:\Qt\5.6\mingw49_32\bin\windeployqt.exe", + $windeployqt = "windeployqt.exe", $iscc = "C:\Program Files (x86)\Inno Setup 5\ISCC.exe", - $gpsbabel_build_dir_name = "build-GPSBabel-Desktop_Qt_5_5_1_Mingw_32bit-Release", - $gui_build_dir_name = "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release" + $gpsbabel_build_dir_name = "build-GPSBabel-Desktop_Qt_5_5_1_MinGW_32bit-Release", + $gui_build_dir_name = "build-app-Desktop_Qt_5_5_1_MinGW_32bit-Release", + $mkspec = "win32-g++", + $mkcmd = "mingw32-make" ) # verify we are in the top of the gpsbabel clone Get-Item tools/make_windows_release.ps1 -ErrorAction Stop @@ -24,10 +28,10 @@ $gui_build_dir = "$($gpsbabel_src_dir)\$($gui_build_dir_name)" Remove-Item "$($gpsbabel_build_dir)" -Recurse -ErrorAction Ignore New-Item "$($gpsbabel_build_dir)" -type directory -force Set-Location "$($gpsbabel_build_dir)" -qmake "$($gpsbabel_src_dir)\GPSBabel.pro" -spec win32-g++ +qmake "$($gpsbabel_src_dir)\GPSBabel.pro" -spec "$($mkspec)" if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } -mingw32-make qmake_all -mingw32-make +& "$($mkcmd)" qmake_all +& "$($mkcmd)" if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } # copy GPSBabel.exe for use by test_script Remove-Item "$($gpsbabel_src_dir)\release" -Recurse -ErrorAction Ignore @@ -38,22 +42,17 @@ Set-Location "$($gpsbabel_src_dir)" Remove-Item "$($gui_build_dir)" -Recurse -ErrorAction Ignore New-Item "$($gui_build_dir)" -type directory -force Set-Location "$($gui_build_dir)" -qmake "$($gpsbabel_src_dir)\gui\app.pro" -spec win32-g++ +qmake "$($gpsbabel_src_dir)\gui\app.pro" -spec "$($mkspec)" if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } -mingw32-make qmake_all -mingw32-make +& "$($mkcmd)" qmake_all +& "$($mkcmd)" if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } lupdate "$($gpsbabel_src_dir)\gui\app.pro" lrelease "$($gpsbabel_src_dir)\gui\app.pro" -# windeployqt in 5.5.1 suffers from bug -# https://bugreports.qt.io/browser/QTBUG-48946 -# which trashes the translations. Work around -# by using the next version of windeployqt which had this -# bug fixed. # use --plugindir option to locate the plugins. & "$($windeployqt)" --verbose 10 --plugindir release\plugins release\GPSBabelFE.exe if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } Set-Location "$($gpsbabel_src_dir)\gui" -& "$($iscc)" setup.iss +& "$($iscc)" /Dgpsbabel_build_dir_name="$($gpsbabel_build_dir_name)" /Dgui_build_dir_name="$($gui_build_dir_name)" setup.iss if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } Set-Location "$($gpsbabel_src_dir)" -- 2.30.2